import { Injectable } from '@angular/core';
import { ContainerConfig, ContainerType } from '../models/layout.models';

@Injectable({
  providedIn: 'root'
})
export class ContainerConfigService {
  private containerConfigs: Record<ContainerType, ContainerConfig> = {
    'single-column': {
      id: 'single-column',
      type: 'single-column',
      title: '单列布局',
      canContain: ['widget']
    },
    'two-columns': {
      id: 'two-columns',
      type: 'two-columns',
      title: '双列布局',
      canContain: ['widget']
    },
    'three-columns': {
      id: 'three-columns',
      type: 'three-columns',
      title: '三列布局',
      canContain: ['widget']
    },
    'four-columns': {
      id: 'four-columns',
      type: 'four-columns',
      title: '四列布局',
      canContain: ['widget']
    },
    'tab-container': {
      id: 'tab-container',
      type: 'tab-container',
      title: 'Tab页容器',
      canContain: ['widget']
    },
    'step-container': {
      id: 'step-container',
      type: 'step-container',
      title: 'Step页容器',
      canContain: ['widget']
    }
  };

  getContainerConfig(type: ContainerType): ContainerConfig {
    return this.containerConfigs[type];
  }

  canContainerAccept(containerType: ContainerType, itemType: 'container' | 'widget'): boolean {
    const config = this.containerConfigs[containerType];
    return config.canContain.includes(itemType);
  }
}
